package fun.lifepoem.store.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Yiwyn
 * @create 2023/3/11 20:36
 */
public class WebUtils {

    public static <T> void renderString(HttpServletResponse response, T data) {
        try {
            response.setStatus(200);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
            String msg = DocUtils.toJSONString(data);
            response.getWriter().print(msg);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
